home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / snippets_vol4 / snip_orbit.dba < prev    next >
Encoding:
Text File  |  2000-10-13  |  1.6 KB  |  79 lines

  1. `    ------------------------------------------------------------------------
  2. `    Orbit                                     DarkForge Snippet (11/10/2000)
  3. `    ------------------------------------------------------------------------
  4. `    Original coded by Yacullo (mike@planetofthegeeks.com) and modified
  5. `    slightly by Requiem to add the background. Used with permission.
  6.  
  7. sync rate 0
  8. sync on
  9. hide mouse
  10.  
  11. sun = 1
  12. planet = 2
  13. moon = 3
  14.  
  15. planetdist = 15
  16. moondist = 5
  17.  
  18. make object sphere sun, 10
  19. color object sun,rgb(255,255,0)
  20. zrotate object sun,240
  21.  
  22. make object sphere planet,5
  23. color object planet,rgb(200,200,200)
  24.  
  25. make object sphere moon,2
  26. color object moon,rgb(150,150,150)
  27.  
  28. position object sun,0,0,0
  29. position object planet,0,0,planetdist
  30. position object moon,0,0,planetdist + moondist
  31.  
  32. position camera 30,10,30
  33. point camera 0,0,0
  34.  
  35. planetAngle = 0
  36. moonAngle = 0
  37.  
  38. `    Set the scene
  39.  
  40. ink rgb(0,255,255),0 : dot 1,1
  41. ink rgb(100,50,155),0 : dot 1,0 : dot 1,2 : dot 0,1 : dot 2,1
  42. get image 1,0,0,3,3
  43.  
  44. cls 0
  45.  
  46. ink rgb(255,255,255),0
  47. for a=0 to 50
  48.     dot 1+rnd(254),1+rnd(254)
  49. next a
  50.  
  51. for a=0 to 6
  52.     paste image 1,3+rnd(250),3+rnd(250)
  53. next a
  54.  
  55. get image 2,0,0,256,256
  56.  
  57. texture backdrop 2
  58.  
  59. do 
  60.  
  61.     planetAngle = wrapvalue(planetAngle + 1)
  62.     position object planet,0,0,0
  63.     yrotate object planet,planetAngle
  64.     move object planet,planetdist
  65.  
  66.     planetX# = object position x(planet)
  67.     planetY# = object position y(planet)
  68.     planetZ# = object position z(planet)
  69.  
  70.     moonAngle = wrapValue(moonAngle + 5)
  71.     position object moon,planetX#,planetY#,planetZ#
  72.     yrotate object moon,moonAngle
  73.     move object moon,moondist
  74.  
  75.     sync
  76.  
  77. loop
  78.  
  79.